#ifndef MyUIH
#define MyUIH

#include <OISMouse.h>
#include <SdkTrays.h>


// MyUI
class MyUI
{
public:

	// Form
	typedef Ogre::OverlayContainer Form;

	// Forms
	typedef std::vector< Form* > Forms;

private:

	OIS::Mouse*             mpMouse;

	Ogre::OverlayManager&   mrManager;
	Ogre::Overlay*          mpFormLayer;
	Ogre::Overlay*          mpCursorLayer;
	Ogre::OverlayContainer* mpCursor;
	Ogre::Real              mCursorX;
	Ogre::Real              mCursorY;
	bool                    mMouseLeftButtonPressed;
	Ogre::OverlayElement*   mpClickedElement;
	Ogre::OverlayElement*   mpDragElement;

	Forms                   mForms;
	Form*                   mpFocusForm;

	Form*                   mpBackpackForm;

public:

	         MyUI( OIS::Mouse* mouse );
	virtual ~MyUI();

	bool OnFrame( const Ogre::FrameEvent& evt );
	bool OnMouseDown( const OIS::MouseEvent& evt, OIS::MouseButtonID id );
	bool OnMouseUp  ( const OIS::MouseEvent& evt, OIS::MouseButtonID id );
	bool OnMouseMove( const OIS::MouseEvent& evt );

private:

	void UpdateCursor();

	void BackpackForm_Initialize();
	void BackpackForm_OnMouseDown( const OIS::MouseEvent& evt, OIS::MouseButtonID id );
	void BackpackForm_OnMouseUp( const OIS::MouseEvent& evt, OIS::MouseButtonID id );
	void BackpackForm_OnMouseMove( const OIS::MouseEvent& evt );
};


#endif
